package galaxy.drawer.action;

import galaxy.drawer.Context;
import galaxy.drawer.drawable.Explosion;

public class ExplodeAction implements Action
{
	private int particles = 100;
	private int lifetime = 64;
	private float rotation = 0;
	private float speed = (float) 0.5;
	private float dispersion = (float) 0.5;
	private int color = 100;
	private double width = 1;
	private double height = 1;
	
	public ExplodeAction()
	{}
	
	public ExplodeAction particles(int amount)
	{
		this.particles = amount;
		return this;
	}
	
	public ExplodeAction steps(int lifetime)
	{
		this.lifetime = lifetime;
		return this;
	}
	
	public ExplodeAction rotate(double angle)
	{
		this.rotation = (float) angle;
		return this;
	}
	
	public ExplodeAction speed(double speed)
	{
		this.speed = (float) speed;
		return this;
	}
	
	public ExplodeAction disperse(double amount)
	{
		this.dispersion = (float) amount;
		return this;
	}
	
	public ExplodeAction color(int color)
	{
		this.color = color;
		return this;
	}
	
	public ExplodeAction width(double width)
	{
		this.width = width;
		return this;
	}
	
	public ExplodeAction height(double height)
	{
		this.height = height;
		return this;
	}
	
	public Context execute(Context c)
	{
		c.drawables.add(new Explosion(c.pos.get(), particles, lifetime, rotation, speed, dispersion, color, c.angle, width, height)); // does c.angle work?

		return c;
	}
}
